package com.tanhua.dubbo.api.db;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanhua.dubbo.api.mapper.UserQuestionMapper;
import com.tanhua.model.db.UserQuestion;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Version 1.0
 * @Author aao
 * @Date 2022/2/21 16:53
 * @Description 试题服务接口实现类
 */
@DubboService
public class UserQuestionApiImpl implements UserQuestionApi{

    @Autowired
    private UserQuestionMapper userQuestionMapper;

    /**
     * 根据问卷id查询试题
     * @param questionnaireId
     * @return
     */
    @Override
    public List<UserQuestion> findByQuestionnaireId(Long questionnaireId) {
        LambdaQueryWrapper<UserQuestion> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UserQuestion::getQuestionnaireId,questionnaireId);
        return userQuestionMapper.selectList(queryWrapper);
    }
}
